package com.example.film.controller;

import com.example.film.entity.InlandWeekChamp;
import com.example.film.service.InlandWeekChampService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@Api(tags = "内地票房历年单周冠军电影信息管理接口")
@CrossOrigin
@RestController
@RequestMapping("inland/v1")
public class InlandWeekController {

    @Autowired
    private InlandWeekChampService inlandWeekChampService;

    @ApiOperation("内地票房历年单周冠军电影信息")
    @GetMapping("/weekFilms")
    public List<InlandWeekChamp> getInlandWeekChamp(){
        return inlandWeekChampService.findInlandWeekChamp();
    }

    @ApiOperation("分页查询内地票房历年单周冠军电影信息")
    @GetMapping("/weekChamp")
    public List<InlandWeekChamp> getInlandWeekChampInfo(@RequestParam(defaultValue = "1") Integer pageNum, @RequestParam(defaultValue = "10") Integer pageSize){
        return inlandWeekChampService.findInlandWeekChampInfo(pageNum, pageSize);
    }
}
